﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.Adapters;
using System.Web.UI.WebControls;
using Eloje_Data;
using eLoje_Model;

namespace ELoje_web
{
    public partial class MedidaLog : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hdnCodMedida.Value = Session["codMedida"].ToString();
                gvMedida.PageIndex = 0;
                loadGrid();
                navigationHistory();

            }
        }

        protected void gvMedida_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvMedida.PageIndex = e.NewPageIndex;
            loadGrid();
        }


        #region Métodos
        private void loadGrid()
        {
            try
            {
                MedidaDA da = new MedidaDA();
                gvMedida.DataSource = da.getMedidaLog(Convert.ToInt32(hdnCodMedida.Value.Trim().ToString()));
                gvMedida.DataBind();
            }
            catch (Exception)
            {

                throw;
            }
        }

        private void navigationHistory()
        {
            lblHistoryNavigation.Text = String.Format("{0} >> {1} >> {2} >> ", "Cockpit", "Cadastros", "Medidas");
            lblThisPage.Text = "Log de Medidas";

        }
        #endregion
    }
}